/**
 * FilesUtils
 * 
 * 05/12/2013
 * 
 * Copyright GPL
 */
package com.jtmproject.javiertejedor.classes;

import android.content.Context;

/**
 * This class contains function to make actions with external files.
 * This class has been designed with Singleton Pattern:
 * http://es.wikipedia.org/wiki/Singleton
 * 
 * @author Javier Tejedor
 */
public class FilesUtils {

	private static FilesUtils filesUtils;
	
	/**
	 * this returns an static instance of the same class(Singleton Pattern)
	 * @return
	 */
	public static FilesUtils getFilesUtils(){
		if(filesUtils == null){
			filesUtils = new FilesUtils();
		}
		
		return filesUtils;
	}
	
	/**
	 * this returns the text from the copyright file
	 * \A Matches the beginning of the string.
	 * @return
	 */
	public String getTextAboutFile(Context context, int resource) {
		return new java.util.Scanner(
				context.getResources().openRawResource(resource),
				"UTF-8").useDelimiter("\\A").next();
	}
	
}
